

gen std_left_right=(left_right_position-5.037573)/1.975736
gen std_asylumseek_pop_eu=(asylumseek_pop_eu-806.9906)/398.7895
gen std_asylumseek_pop_nat=(asylumseek_pop_nat-747.741)/934.2607

gen _ISSUE_NAT_mis=_ISSUE_NAT
replace _ISSUE_NAT_mis=. if issue_country_15==1 | issue_country_16==1 |  issue_eu_15==1 | issue_eu_16==1
gen _ISSUE_EU_mis=_ISSUE_EU
replace _ISSUE_EU_mis=. if issue_eu_15==1 | issue_eu_16==1 | issue_country_15==1 | issue_country_16==1
gen _ISSUE_NO_mis=_ISSUE_NO
replace _ISSUE_NO_mis=. if issue_country_15==1 | issue_country_16==1 | issue_eu_15==1 | issue_eu_16==1

*** STANDARDIZED VARIABLES
gen std_IMM=.
replace std_IMM=(IMM-2450.8347)/1540.3028 if country==1
replace std_IMM=(IMM-1101.5201)/366.28325 if country==2
replace std_IMM=(IMM-2291.7088)/631.84975 if country==3
replace std_IMM=(IMM-1496.5807)/675.40849 if country==5
replace std_IMM=(IMM-1665.6839)/1023.6524 if country==7
replace std_IMM=(IMM-932.24673)/344.55737 if country==8
replace std_IMM=(IMM-1857.9369)/845.86715 if country==9
replace std_IMM=(IMM-2219.9695)/1153.6984 if country==11

gen std_IMM_EU=.
replace std_IMM_EU=(IMM_EU-643.84866)/413.77403 if country==1
replace std_IMM_EU=(IMM_EU-690.41429)/271.34181 if country==2
replace std_IMM_EU=(IMM_EU-92.968265)/46.708004 if country==3
replace std_IMM_EU=(IMM_EU-332.32879)/205.81399 if country==5
replace std_IMM_EU=(IMM_EU-486.52962)/367.14156 if country==7
replace std_IMM_EU=(IMM_EU-378.63422)/199.01212 if country==8
replace std_IMM_EU=(IMM_EU-909.4452)/684.24311 if country==9
replace std_IMM_EU=(IMM_EU-380.05563)/295.18244 if country==11

gen std_PF_IMM=(PF_IMM-.1394572)/.1303857
gen std_PF_IMM_EU=(PF_IMM_EU-.2689347)/.2495333

gen std_asylumseek_nat_EU=(asylumseek_pop_eu_10000-8.069906)/3.987895
gen std_asylumseek_pop_nat_10000=(asylumseek_pop_nat_10000-7.47741)/9.342607
gen std_asylumseek_nat_EU=(asylumseek_nat_EU-.9324685)/.8130699

label drop left_right_position
label define left_right_position 1"1 (Left)" 2"2" 3"3" 4"4" 5"5" 6"6" 7"7" 8"8" 9"9" 10"10 (Right)"
label values left_right_position left_right_position

*********** Marginal effects of media agenda on solution levels *********
*Generating binary measures of prefered solution levels
gen BIN_solNAT=0 if immigration_decision_level==4
replace BIN_solNAT=1 if immigration_decision_level==2
gen BIN_solEU=0 if immigration_decision_level==4
replace BIN_solEU=1 if immigration_decision_level==1
gen BIN_solEUnat=0 if immigration_decision_level==4
replace BIN_solEUnat=1 if immigration_decision_level==3


*************************************************************************
************************ TABLE 1 no interactions ************************
*************************************************************************
*National issue - no interactions
logit _ISSUE_NAT_mis std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_pop_nat_10000 std_asylumseek_nat_EU ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar i.country, robust or
*EU issue - no interactions
logit _ISSUE_EU_mis std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_pop_nat_10000 std_asylumseek_nat_EU ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar i.country, robust or

*Solution level - no interactions
mlogit immigration_decision_level std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_pop_nat_10000 std_asylumseek_nat_EU ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar i.country, robust base(4) rrr

*************************************************************************
************************* TABLE 2 - interactions ************************
*************************************************************************

*National issue
logit _ISSUE_NAT_mis std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_pop_nat_10000 std_asylumseek_nat_EU ///
c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position ///
female age education urbanization income i.edatevar i.country, robust or
*EU issue
logit _ISSUE_EU_mis std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_pop_nat_10000 std_asylumseek_nat_EU ///
c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position ///
female age education urbanization income i.edatevar i.country, robust or
*solution level
mlogit immigration_decision_level std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_pop_nat_10000 std_asylumseek_nat_EU ///
c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_PF_IMM##c.left_right_position ///
female age education urbanization income i.edatevar i.country, robust base(4) rrr

*************************************************************************
********************** Marginal effects - Figure 1 **********************
*************************************************************************
*National issue
quietly logit _ISSUE_NAT_mis std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_pop_nat_10000 std_asylumseek_nat_EU ///
c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position ///
female age education urbanization income i.edatevar i.country, robust
quietly margins, dydx(std_IMM) at(left_right_position=(1(1)10))
marginsplot, recast(line) recastci(rarea) name(margins_h, replace) title("National issue") ytitle("Marginal effect of Media agenda") xtitle("Left-right spectrum") yline(0) ylabel(-.1(.05).1)
*EU issue
quietly logit _ISSUE_EU_mis std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_pop_nat_10000 std_asylumseek_nat_EU ///
c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position ///
female age education urbanization income i.edatevar i.country, robust
quietly margins, dydx(std_IMM) at(left_right_position=(1(1)10))
marginsplot, recast(line) recastci(rarea) name(margins_h, replace) title("EU issue") ytitle("Marginal effect of Media agenda") xtitle("Left-right spectrum") yline(0) ylabel(-.1(.05).1)
*************************************************************************
********************* Marginal effects - Figure 2 ***********************
*************************************************************************

*National solution
quietly logit BIN_solNAT std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_pop_nat_10000 std_asylumseek_nat_EU ///
c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_PF_IMM##c.left_right_position ///
female age education urbanization income i.edatevar i.country, robust
quietly margins, dydx(std_PF_IMM) at(left_right_position=(1(1)10))
marginsplot, recast(line) recastci(rarea) name(margins_a, replace) title("National solution") ytitle("Marginal effect media framing") xtitle("Left-right spectrum") yline(0) ylabel(-.15(.05).15)
*EU solution
quietly logit BIN_solEU std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_pop_nat_10000 std_asylumseek_nat_EU ///
c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_PF_IMM##c.left_right_position ///
female age education urbanization income i.edatevar i.country, robust
quietly margins, dydx(std_PF_IMM) at(left_right_position=(1(1)10))
marginsplot, recast(line) recastci(rarea) name(margins_a, replace) title("EU solution") ytitle("Marginal effect media framing") xtitle("Left-right spectrum") yline(0) ylabel(-.15(.05).15)
*Both solution
quietly logit BIN_solEUnat std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_pop_nat_10000 std_asylumseek_nat_EU ///
c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_PF_IMM##c.left_right_position ///
female age education urbanization income i.edatevar i.country, robust
quietly margins, dydx(std_PF_IMM) at(left_right_position=(1(1)10))
marginsplot, recast(line) recastci(rarea) name(margins_a, replace) title("EU & national solution") ytitle("Marginal effect media framing") xtitle("Left-right spectrum") yline(0) ylabel(-.15(.05).15)





*************************************************************************
*************************** ROBUSTNESS CHECKS ***************************
*************************************************************************

mark nomiss
markout nomiss immigration_decision_level left_right_position std_IMM std_IMM_EU std_PF_IMM std_PF_IMM_EU std_asylumseek_nat_EU std_asylumseek_pop_nat_10000 female age education urbanization income country edatevar
sum IMM IMM_EU PF_IMM PF_IMM_EU asylumseek_pop_eu_10000 asylumseek_pop_nat_10000 left_right_position female age education urbanization income if nomiss==1

mark nomiss2
markout nomiss2 _ISSUE_NAT_mis std_IMM std_IMM_EU std_asylumseek_nat_EU std_asylumseek_pop_nat_10000 left_right_position female age education urbanization income edatevar country

sum IMM IMM_EU PF_IMM PF_IMM_EU asylumseek_pop_eu_10000 asylumseek_pop_nat_10000 left_right_position female age education urbanization income if nomiss2==1
**********************  Individual Country checks  **********************
************ Germany
*Perception
logit _ISSUE_NAT_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==1, robust
logit _ISSUE_EU_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==1, robust
logit _ISSUE_NO_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==1, robust
*Solution
mlogit immigration_decision_level c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position c.std_PF_IMM##c.left_right_position c.std_PF_IMM_EU##c.left_right_position ///
std_asylumseek_pop_nat_10000 female age education urbanization income i.edatevar if country==1, robust base(4)
************ France
*Perception
logit _ISSUE_NAT_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==2, robust
logit _ISSUE_EU_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==2, robust
logit _ISSUE_NO_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==2, robust
*Solution
mlogit immigration_decision_level c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position c.std_PF_IMM##c.left_right_position c.std_PF_IMM_EU##c.left_right_position ///
std_asylumseek_pop_nat_10000 female age education urbanization income i.edatevar if country==2, robust base(4)
************ Italy
*Perception
logit _ISSUE_NAT_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==3, robust
logit _ISSUE_EU_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==3, robust
logit _ISSUE_NO_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==3, robust
*Solution
mlogit immigration_decision_level c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position c.std_PF_IMM##c.left_right_position c.std_PF_IMM_EU##c.left_right_position ///
std_asylumseek_pop_nat_10000 female age education urbanization income i.edatevar if country==3, robust base(4)
************ Netherlands
*Perception
logit _ISSUE_NAT_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==5, robust
logit _ISSUE_EU_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==5, robust
logit _ISSUE_NO_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==5, robust
*Solution
mlogit immigration_decision_level c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position c.std_PF_IMM##c.left_right_position c.std_PF_IMM_EU##c.left_right_position ///
std_asylumseek_pop_nat_10000 female age education urbanization income i.edatevar if country==5, robust base(4)
************ Denmark
*Perception
logit _ISSUE_NAT_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==7, robust
logit _ISSUE_EU_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==7, robust
logit _ISSUE_NO_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==7, robust
*Solution
mlogit immigration_decision_level c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position c.std_PF_IMM##c.left_right_position c.std_PF_IMM_EU##c.left_right_position ///
std_asylumseek_pop_nat_10000 female age education urbanization income i.edatevar if country==7, robust base(4)
************ Ireland
*Perception
logit _ISSUE_NAT_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==8, robust
logit _ISSUE_EU_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==8, robust
logit _ISSUE_NO_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==8, robust
*Solution
mlogit immigration_decision_level c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position c.std_PF_IMM##c.left_right_position c.std_PF_IMM_EU##c.left_right_position ///
std_asylumseek_pop_nat_10000 female age education urbanization income i.edatevar if country==8, robust base(4)
************ United Kingdom
*Perception
logit _ISSUE_NAT_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==9, robust
logit _ISSUE_EU_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==9, robust
logit _ISSUE_NO_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==9, robust
*Solution
mlogit immigration_decision_level c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position c.std_PF_IMM##c.left_right_position c.std_PF_IMM_EU##c.left_right_position ///
std_asylumseek_pop_nat_10000 female age education urbanization income i.edatevar if country==9, robust base(4)
************ Spain
*Perception
logit _ISSUE_NAT_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==11, robust
logit _ISSUE_EU_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==11, robust
logit _ISSUE_NO_mis c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position std_asylumseek_pop_nat_10000 ///
c.left_right_position##c.left_right_position female age education urbanization income i.edatevar if country==11, robust
*Solution
mlogit immigration_decision_level c.left_right_position##c.left_right_position c.std_IMM##c.left_right_position c.std_IMM_EU##c.left_right_position c.std_PF_IMM##c.left_right_position c.std_PF_IMM_EU##c.left_right_position ///
std_asylumseek_pop_nat_10000 female age education urbanization income i.edatevar if country==11, robust base(4)


****** Checks for reversed causality (lagged independent variable *******

logit _ISSUE_NAT_mis lead_IMM lead_IMM_EU
logit _ISSUE_NAT_mis IMM IMM_EU

logit _ISSUE_EU_mis lead_IMM lead_IMM_EU
logit _ISSUE_EU_mis IMM IMM_EU

logit _ISSUE_NO_mis lead_IMM lead_IMM_EU
logit _ISSUE_NO_mis IMM IMM_EU

mlogit immigration_decision_level lead_IMM lead_IMM_EU lead_PF_IMM lead_PF_IMM_EU
mlogit immigration_decision_level IMM IMM_EU PF_IMM PF_IMM_EU











